#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n,i;
	int a[10000];
	int max = 10000000, min = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		if (a[i] > min) min = a[i];
		if (a[i] < max) max = a[i];

	}
	printf("%d", min - max);
	return 0;
}